//
//  BatchBranchSearchCell.swift
//  SBSafetyApp
//
//  Created by Lina on 2023/1/28.
//

import Foundation
import UIKit

class BatchBranchSearchCell: BranchSearchCell {
    let selectIV = UIImageView()
    
    func reload(withModal modal: DeptModal, curs: [String?]) {
        super.reload(withModal: modal)

        var iF = false
        curs.forEach { item in
            if item == String(modal.deptId!) {
                iF = true
            }
        }
        
        if curs.count > 0 && iF {
            selectIV.image = UIImage(systemName: "checkmark.square.fill")
            selectIV.tintColor = .primary
        } else {
            selectIV.image = UIImage(systemName: "square")
            selectIV.tintColor = .hex("#EDEDED")
        }
    }
    
    override func setupUI() {
        super.setupUI()

        selectIV.image = UIImage(systemName: "circle.fill")
        addSubview(selectIV)
        selectIV.snp.makeConstraints { (make) -> Void in
            make.centerY.equalTo(self.snp.centerY)
            make.left.equalTo(self.snp.left).offset(25)
            make.width.height.equalTo(25)
        }
        
        iconL.snp.remakeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalTo(selectIV.snp.right).offset(10)
            make.width.height.equalTo(40)
        }
    }
}
